<el-dialog id="formLog" title="文件日志" :visible.sync="dialogLogVisible" width="800px" append-to-body v-cloak>
    <el-table ref="multipleTable1"
              height="calc(100vh - 360px)"
              border
              :data="logDataList"
              row-key="id"
              v-loading="loadingDialog"
              tooltip-effect="dark">
        <template slot="empty">{{emptyTextDialog}}</template>
        <el-table-column label="编号"  prop="fileCode" show-overflow-tooltip>
            <template slot-scope="scope,text">
                {{(currentPageDialog - 1) * pageSizeDialog +(scope.$index+1)}}
            </template>
        </el-table-column>
        <el-table-column label="操作人" align="center" prop="operatorName"  >
        </el-table-column>
        <el-table-column label="操作内容" align="center" prop="operateType" >
        </el-table-column>
        <el-table-column label="操作时间" align="center" prop="operateDate"  width="180">
        </el-table-column>
    </el-table>
    <el-pagination
            background
            layout="total, prev, pager, next, jumper"
            :current-page="currentPageDialog"
            :page-size="pageSizeDialog"
            :total="totalDialog"
            class="ms-pagination"
            @current-change='currentChangeLog'>
    </el-pagination>
    <div slot="footer">
        <el-button size="mini" @click="dialogLogVisible = false">取 消</el-button>
        <el-button size="mini" type="primary" @click="dialogLogVisible = false">确 认</el-button>
    </div>
</el-dialog>
<script>
    var formLog = new Vue({
        el: '#formLog',
        data: function () {
            return {
                logForm:{},
                logDataList:[],
                totalDialog: 0,
                //总记录数量
                pageSizeDialog: 8,
                //页面数量
                currentPageDialog: 1,
                //加载状态
                loadingDialog: true,
                emptyTextDialog:'',
                dialogLogVisible:false,
            };
        },
        watch: {
        },
        computed: {},
        methods: {
            listLog: function () {
                var that = this;
                this.loadingDialog = true;
                var page = {
                    pageNo: that.currentPageDialog,
                    pageSize: that.pageSizeDialog
                };
                var form = that.logForm
                ms.http.post(ms.manager + "/cms/document/logs.do", Object.assign({}, form, page),{
                    headers: {
                        'Content-Type': 'application/json'
                    }
                }).then(function (res) {
                    that.loadingDialog = false;

                    if (!res.result || res.data.total <= 0) {
                        that.emptyTextDialog = '暂无数据';
                        that.logDataList = [];
                        that.totalDialog = 0;
                    } else {
                        that.emptyTextDialog = '';
                        that.totalDialog = res.data.total;
                        that.logDataList = res.data.records;
                    }
                });
            },
            //currentPage改变时会触发
            currentChangeLog: function (currentPage) {
                this.loadingDialog = true;
                this.currentPageDialog = currentPage;
                this.listLog();
            },
            showLogDialog:function (row) {
                this.initDialogData();
                this.logForm.fileId =row[0].id;
                this.pageSizeDialog= 8;
                this.dialogLogVisible = true
                this.listLog();
            },
            initDialogData:function () {
                this.totalDialog=0;
                this.pageSizeDialog= 10;
                this.currentPageDialog= 1;
                this.loadingDialog=true;
                this.emptyTextDialog='';
            }
        },
        created: function () {}
    });
</script>
<style>

</style>
